package com.sino.operation.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sino.operation.entity.SysTransCenter;
import com.sino.operation.mapper.SysTransCenterMapper;
import com.sino.operation.service.SysTransCenterService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author admin
 * @since 2021-10-07
 */
@Service
public class SysTransCenterServiceImpl extends ServiceImpl<SysTransCenterMapper, SysTransCenter> implements SysTransCenterService {
    @Autowired(required = false)
    private SysTransCenterMapper sysTransCenterMapper;

    @Override
    public IPage<SysTransCenter> selectList(Map<String, String> map) {
        QueryWrapper<SysTransCenter> wrapper = new QueryWrapper<>();
        if (map.containsKey("centerNo") && map.get("centerNo") != null && !map.get("centerNo").trim().isEmpty()) {
            wrapper.eq("CENTER_NO", map.get("centerNo"));
        }
        if (map.containsKey("transType") && map.get("transType") != null && !map.get("transType").trim().isEmpty()) {
            wrapper.eq("TRANS_TYPE", map.get("transType"));
        }
        return sysTransCenterMapper.selectPage(new Page<>(Integer.parseInt(map.get("current")), Integer.parseInt(map.get("size"))), wrapper);
    }
}
